package com.sx.baseproject.framework.arouth

import android.app.Activity
import com.alibaba.android.arouter.launcher.ARouter
import com.sx.baseproject.module.homePage.GroupOrderFragment
import com.sx.baseproject.module.homePage.LiveFragment
import com.sx.baseproject.module.homePage.MineFragment

/**
 * @Description
 * @Author 梁浩文
 * @Date 2021/6/25 14:08
 */
class RouteManager {
    companion object {
        private var instance: RouteManager? = null

        @Synchronized
        fun getInstance(): RouteManager {
            if (instance == null) {
                instance = RouteManager()
            }
            return instance!!
        }
    }

    fun intentToMain(activity: Activity) {
        ARouter.getInstance().build(RoutePath.MAIN).navigation();
    }

    fun getGroupOrderFragment(): GroupOrderFragment =
        ARouter.getInstance().build(RoutePath.MAIN_GROUP).navigation() as GroupOrderFragment

    fun getLiveFragment(): LiveFragment =
        ARouter.getInstance().build(RoutePath.MAIN_LIVE).navigation() as LiveFragment

    fun getMineFragment(): MineFragment =
        ARouter.getInstance().build(RoutePath.MAIN_MINE).navigation() as MineFragment
}